<template>
  <div class="qiye">
    <el-form-item label-width="120px" label="企业：" prop="enterpriseID">
      <el-select
        style="width: 100%"
        v-model="enterpriseID"
        placeholder="请选择"
        @change="changes"
      >
        <el-option
          :label="item.company"
          :value="item.id"
          v-for="(item, i) in list"
          :key="i"
        >
        </el-option>
      </el-select>
    </el-form-item>
  </div>
</template>

<script>
import { list } from '@/api/hmmm/companys.js'
export default {
  name: 'Qiye',
  prop: {
    type: Object,
    required: true
  },
  data() {
    return {
      list: [],
      enterpriseID: ''
    }
  },
  created() {
    this.getList()
  },
  methods: {
    async getList() {
      try {
        const { data } = await list()
        // console.log(data)
        this.list = data.items
      } catch (err) {
        console.log('错误')
      }
    },
    changes() {
      this.$emit('enterprise', this.enterpriseID)
    }
  }
}
</script>

<style lang="less" scoped></style>
